/**
 * Created with IntelliJ IDEA.
 * User: Yura
 * Date: 19.09.13
 * Time: 16:43
 * To change this template use File | Settings | File Templates.
 */

package kpi.training.division;
import java.util.*;

public class Division {

    public static void main(String[] args)
    {
        Scanner scan=new Scanner(System.in);
        int numerator = getIntFrom(scan);
        int denominator = 0;
        while (denominator == 0)
        {
            denominator = getIntFrom(scan);
        }


        printDivisionColumn(numerator,denominator);



    }

    /**
     * This method returns number of digits ('-' is digit too)
     */
    public static int getLengthOf(int number)
    {
        int length = 0;
        if (number < 0)
        {
            length ++;
        }
        do{
            number /= 10;  /* 10 - radix */
            length ++;
        } while (number != 0);
        return length;
    }

    public static int getIntFrom(Scanner input)
    {
        return input.nextInt();
    }
    
    public static int[] intToArray(int originalNumber)
    {
        int[] numberAsArray = new int[getLengthOf(originalNumber)];
        int lengthOfOriginalNumber = getLengthOf(originalNumber);
        for (int i=0; i<lengthOfOriginalNumber; i++)     /* We can't replace this variable into getLengthOf(originalNumber) */
        {
            numberAsArray[i]=originalNumber%10; /* 10 - radix */
            originalNumber/=10;
        }
        return numberAsArray;
    }

    public static void printDivisionColumn(int numerator, int denominator)
    {
        System.out.printf(" %d/%d\n", numerator, denominator);
        int[] numeratorAsArray = intToArray(numerator);
        int quotient=0;
        int currentModulo=0;
        int lengthOfNumerator = getLengthOf(numerator);
        for (int currentDigitOfNumerator=0; currentDigitOfNumerator<lengthOfNumerator; currentDigitOfNumerator++)
        {
            int indent = 2 ;
            currentModulo=currentModulo*10+numeratorAsArray[lengthOfNumerator-currentDigitOfNumerator-1];  /* 10 - radix */
            int currentDigitOfQuotient=currentModulo/denominator;
            int upperIndent = currentDigitOfNumerator - getLengthOf(currentModulo) + indent;
            int middleIndent = currentDigitOfNumerator - getLengthOf(currentDigitOfQuotient * denominator) + indent;
            printCharacterWithRepeat(' ', upperIndent);
            System.out.println(currentModulo);
            printCharacterWithRepeat(' ', middleIndent);
            System.out.println(currentDigitOfQuotient*denominator);
            printCharacterWithRepeat(' ',Math.min(upperIndent,middleIndent));
            printCharacterWithRepeat('-',currentDigitOfNumerator + indent - Math.min(upperIndent,middleIndent));
            System.out.println();
            quotient=quotient*10+currentDigitOfQuotient;    /* 10 - radix */
            currentModulo%=denominator;
        }
        System.out.printf("quotient=%d modulo=%d\n", quotient, currentModulo);
    }

    public static void printCharacterWithRepeat(char character, int numberOfRepeat)
    {
        for (int i = 0; i < numberOfRepeat; i++)
        {
            System.out.print(character);
        }
    }


}
